<template>
  <div class="app-container">

    <el-button @click="deviceThumbnail">/deviceThumbnail</el-button>
    <el-button @click="devices">/devices</el-button>
    <el-button @click="getPuResource">/getPuResource</el-button>
    <el-button @click="treed">/treed</el-button>
    <el-button @click="treedp">/treedp</el-button>
    <el-button @click="treedpd">/treedpd</el-button>
    <el-button @click="plays">/video/plays</el-button>
    <el-button @click="playList">/video/playList</el-button>
    <el-button @click="statistic">/home/statistic</el-button>
    <el-button @click="updateDeviceWall">/video/updateDeviceWall</el-button>
    <el-button @click="getThum">/video/project/getThum</el-button>
    <el-button @click="statisticDevices">/home/statisticDevices</el-button>

    <el-table
      :data="data"
      style="width: 100%"
    >
      <el-table-column
        prop="deviceId"
        label="deviceId"
      />
      <el-table-column
        prop="deviceCode"
        label="deviceCode"
      />
      <el-table-column
        prop="deviceType"
        label="deviceType"
      />
      <el-table-column
        prop="deviceName"
        label="deviceName"
      />
    </el-table>

  </div>
</template>

<script>
import request from '@/utils/request'

export default {
  name: 'Application',
  data() {
    return {
      data: []
    }
  },
  created() {

  },
  methods: {
    deviceThumbnail() {
      request({
        url: '/home/deviceThumbnail',
        method: 'get',
        params: {
          deviceId: 434
        }
      }).then(resp => {
        this.data = resp.data
        console.info(resp.data)
      })
    },
    devices() {
      request({
        url: '/home/devices',
        method: 'get',
        params: {
          deviceTypes: '1,2,8',
          projectId: 418
        }
      }).then(resp => {
        this.data = resp.data
        console.info(resp.data)
      })
    },
    getPuResource() {
      request({
        url: '/video/getPuResource',
        method: 'get',
        params: {
          projectId: 418
        }
      }).then(resp => {
        this.data = resp.data

        console.info(resp.data)
      })
    },
    treed() {
      request({
        url: '/video/project/treed',
        method: 'get'
      }).then(resp => {
        this.data = resp.data

        console.info(resp.data)
      })
    },
    treedp() {
      request({
        url: '/video/project/treedp',
        method: 'get'
      }).then(resp => {
        this.data = resp.data

        console.info(resp.data)
      })
    },
    treedpd() {
      request({
        url: '/video/project/treedpd',
        method: 'get'
      }).then(resp => {
        this.data = resp.data

        console.info(resp.data)
      })
    },
    statisticDevices() {
      request({
        url: '/home/statisticDevices',
        method: 'get'
      }).then(resp => {
        this.data = resp.data

        console.info(resp.data)
      })
    },
    getThum() {
      request({
        url: '/video/project/getThum/418',
        method: 'get'
      }).then(resp => {
        this.data = resp.data

        console.info(resp.data)
      })
    },
    plays() {
      request({
        url: '/video/plays',
        method: 'get',
        params: {
          projectId: 418,
          size: 3
        }
      }).then(resp => {
        console.info(resp.data)
        this.data = resp.data
      })
    },
    playList() {
      request({
        url: '/video/playList',
        method: 'get',
        params: {
          // projectId: 418,
          size: 9
        }
      }).then(resp => {
        console.info(resp.data)
        this.data = resp.data
      })
    },
    statistic() {
      console.info('statistic')
      request({
        url: '/home/statistic',
        method: 'get',
        params: {
          //
          // projectId: 418,
          //
          // projectId: 418,
          // 分屏数量
          size: 3
          // projectType: 'business'
        }
      }).then(resp => {
        console.info(resp.data)
        this.data = resp.data
      })
    },
    updateDeviceWall() {
      console.info('updateDeviceWall')
      request({
        url: '/video/updateDeviceWall',
        method: 'post',
        data: [{
          deviceId: 433, // 设备id
          wallNum: 6 // 九宫格位置1~9
        }]
      }).then(resp => {
        console.info(resp.data)
        this.data = resp.data
      })
    }

  }
}
</script>
<style type="scss">
.safe-green {
  color: #1ab394;
}
.danger-red {
  color: #c03639;
}
</style>
